<?php

/**
 * default actions.
 *
 * @package    DUYTAN
 * @subpackage default
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class defaultActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  
  public function executeIndex(sfWebRequest $request)
  {
	  
	//Get all images slides
	$q = Doctrine_Query::create()
		->from('DtCms c')
		->where('c.category_id = ?', 1);
	$this->slides = $q->fetchArray();
	
	//Get copyright
	$this->copyright = "";
	$c = Doctrine_Core::getTable('DtPage')->findOneByAlias('copyright');
	if ($c)
		$this->copyright = htmlspecialchars_decode($c->content);
	
	//Get list grounds	
	$g = Doctrine_Query::create()
		->from('DtGround c')
		->orderBy('c.display_position ASC');
	$this->grounds = $g->fetchArray();
		
    return SfView::SUCCESS;
  }
  
  public function executePermalink(sfWebRequest $request)
  {
	//Get all images slides
	$q = Doctrine_Query::create()
		->from('DtCms c')
		->where('c.category_id = ?', 1);
	$this->slides = $q->fetchArray();
	
	//Get copyright
	$this->copyright = "";
	$c = Doctrine_Core::getTable('DtPage')->findOneByAlias('copyright');
	if ($c)
		$this->copyright = $c->content;
	
	//Get list grounds	
	$g = Doctrine_Query::create()
		->from('DtGround c')
		->orderBy('c.display_position ASC');
	$this->grounds = $g->fetchArray();
	
	$this->scroll = 0;
	if ($request->getParameter('scroll'))
		$this->scroll = 1;
		
    return SfView::SUCCESS;
  }
}
